using System;
using System.Drawing;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace RPGOnline.Remoting.Entities
{
    [DataContract]
    [KnownType(typeof(FontStyle))]
    [KnownType(typeof(GraphicsUnit))]
    public class User
    {
        public User(string name, Font font, Color fontColor)
        {
            Id = Guid.NewGuid();
            Name = name;
            Font = font;
            FontColor = fontColor;
        }

        [DataMember]
        public Guid Id { get; private set; }
        [DataMember]
        public Font Font { get; private set; }
        [DataMember]
        public Color FontColor { get; set; }
        [DataMember]
        public string Name { get; set; }
        [DataMember]
        public string CharacterName { get; set; }

        public bool Equals(User other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return other.Id.Equals(Id);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (User)) return false;
            return Equals((User) obj);
        }

        public override int GetHashCode()
        {
            return Id.GetHashCode();
        }
    }
}